﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace WizzardTheGame
{
    class Ground
    {
        private Vector3 position;
        private Vector3 length;
        private Texture3D texture;

        #region properties

        public Vector3 Position
        {
            get { return position; }
            set { position = value; }
        }

        public Vector3 Length
        {
            get { return length; }
            set { length = value; }
        }

        #endregion

        public Ground(Vector3 position, Vector3 length)
        {
            Position = position;
            Length = length;

        }

        public bool TestCollision(Vector3 objectPosition)
        {
            bool result = false;
            if ((Position.X <= objectPosition.X && objectPosition.X <= (Position.X + Length.X)) ||
(Position.X >= objectPosition.X && objectPosition.X >= (Position.X + Length.X)))
            {
                if ((Position.Y <= objectPosition.Y && objectPosition.Y <= (Position.Y + Length.Y)) ||
(Position.Y >= objectPosition.Y && objectPosition.Y >= (Position.Y + Length.Y)))
                {
                    result = true;
                    if ((Position.Z <= objectPosition.Z && objectPosition.Z <= (Position.Z + Length.Z)) ||
    (Position.Z >= objectPosition.Z && objectPosition.Z >= (Position.Z + Length.Z)))
                    {
                        result = true;
                    }
                }
            }

            return result;
        }
    }
}
